package com.hotel.ordersystem.controller;


import com.common.status.ResultMsg;
import com.common.status.StatusCode;
import com.common.utils.ResultUtils;
import com.common.utils.ResultVo;
import com.hotel.ordersystem.pojo.CommentList;
import com.hotel.ordersystem.service.CommentListService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (CommentList)表控制层
 *
 * @author makejava
 * @since 2022-09-30 19:21:03
 */
@Api(value = "CommentListController",tags = {"评论模块"})
@RestController
@RequestMapping("commentList")
public class CommentListController {
    /**
     * 服务对象
     */
    @Resource
    private CommentListService commentListService;

    @ApiOperation(value = "评论列表")
    @GetMapping("/getCommentList")
    public ResultVo<List<CommentList>> getUserList() {
        List<CommentList> list = commentListService.list();
        if (list.size() != 0) return ResultUtils.success(ResultMsg.SUCCESS_MSG, StatusCode.SUCCESS_CODE,list);
        else return ResultUtils.error(ResultMsg.DATA_NULL, StatusCode.SYSTEM_ERROR_CODE,null);
    }
}

